import { getPosIDs, getUserID } from '@/utils';

/**
 * 切换列表
 * @param curRes 权限数据
 * @returns
 */

const HomeTaskTabSwitch = (curRes: Record<string, any>) => {
  /**
   * 待办还是已办
   * @taskType  true :已办   false : 待办
   */
  // if (curRes?.['/purchaseSourceClarifyController/taskManage/0/0']) {
  //   return {
  //     queryType: '0',
  //     params: 'applyCompanyID',
  //   };
  // } else if (curRes?.['/purchaseSourceClarifyController/taskManage/0/1']) {
  //   return {
  //     assigneePositionID: getLevelSecond(),
  //     queryType: '1',
  //     params: 'applyDepartmentID',
  //   };
  // } else
  if (curRes?.['/purchaseSourceClarifyController/taskManage/0/2']) {
    return {
      assigneePositionID: getPosIDs(),
      queryType: '2',
      params: 'applyerID',
    };
  } else {
    return {};
  }
};

/** 权限信息 */
const getHomeTabSwitch = (curRes: Record<string, any>) => {
  // if (curRes?.['/purchaseSourceClarifyController/applyCompanyID']) {
  //   return {
  //     applyCompanyID: getLevelZero(),
  //     params: 'applyCompanyID',
  //   };
  // } else if (curRes?.['/purchaseSourceClarifyController/applyDepartmentID']) {
  //   return {
  //     applyDepartmentID: getLevelFirst(),
  //     params: 'applyDepartmentID',
  //   };
  // } else
  if (curRes?.['/purchaseSourceClarifyController/applyerID']) {
    return {
      applyerID: getUserID(),
      params: 'applyerID',
    };
  }
  return {};
};

export { HomeTaskTabSwitch, getHomeTabSwitch };
